package com.agora;


import com.agora.util.DynamicKey4;

import java.util.Date;
import java.util.Random;

/**
 * Created by liwei on 5/14/16.
 */

public class DynamicKey4Sample {
    static String appID   = "612ca682ce3245a6b2b83e6dd54de535";
    static String appCertificate      = "f1685ba50b41451abfa5069e527c8503";
    static String channel  = "7d72365eb983485397e3e3f9d460bdda";
    static int ts = (int)(new Date().getTime()/1000);
    static int r = new Random().nextInt();
    static long uid = 2882341273L;
    static int expiredTs = 0;

    public static void main(String[] args) throws Exception {
        System.out.println(DynamicKey4.generateMediaChannelKey(appID, appCertificate, channel, ts, r, uid, expiredTs));
        System.out.println(DynamicKey4.generateRecordingKey(appID, appCertificate, channel, ts, r, uid, expiredTs));
    }
    public static String getChannelKey(String appID,String channel,int ts,int r,long uid,int expiredTs) throws Exception {
        return  DynamicKey4.generateMediaChannelKey(appID, appCertificate, channel, ts, r, uid, expiredTs);

    }
    public static String getRecordKey(String appID,String channel,int ts,int r,long uid,int expiredTs) throws Exception {
        return  DynamicKey4.generateRecordingKey(appID, appCertificate, channel, ts, r, uid, expiredTs);

    }
}
